// Datei: AbstractDataModel.java
package model;

import java.util.Observable;

public abstract class AbstractDataModel extends Observable
{
   private int m_redValue = 0;
   private int m_greenValue = 0;
   private int m_blueValue = 0;   

   public double getBluePercentage()
   {
      double total = m_redValue + m_greenValue + m_blueValue;      
      if (m_redValue + m_greenValue + m_blueValue > 0) 
      {
         return m_blueValue / total;
      }
      return 0;
   }

   public double getGreenPercentage()
   {
      double total = m_redValue + m_greenValue + m_blueValue;
      if (total > 0)
      {
         return m_greenValue / total;
      }
      return 0;
   }

   public double getRedPercentage()
   {      
      double total = m_redValue + m_greenValue + m_blueValue;
      if (total > 0) 
      {
         return m_redValue / total;
      }
      return 0;
   }

   public void setBlueValue (int value)
   {
      m_blueValue = value;
   }

   public void setGreenValue (int value)
   {
      m_greenValue = value;
   }

   public void setRedValue (int value)
   {
      m_redValue = value;
   }
}